package com.woniuxy.joylife.manager.controller;

import com.woniuxy.joylife.manager.entity.OwnerRoomEntity;
import com.woniuxy.joylife.manager.service.OwnerRoomService;
import com.woniuxy.joylife.manager.utils.PageUtils;
import com.woniuxy.joylife.manager.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 居住信息表
 *
 * @author renxiang
 * @email 981405195@qq.com
 * @date 2020-05-13 02:47:54
 */
@RestController
@RequestMapping("manager/ownerroom")
public class OwnerRoomController {
    @Autowired
    private OwnerRoomService ownerRoomService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("manager:ownerroom:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = ownerRoomService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{orId}")
    //@RequiresPermissions("manager:ownerroom:info")
    public R info(@PathVariable("orId") String orId){
		OwnerRoomEntity ownerRoom = ownerRoomService.getById(orId);

        return R.ok().put("ownerRoom", ownerRoom);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("manager:ownerroom:save")
    public R save(@RequestBody OwnerRoomEntity ownerRoom){
		ownerRoomService.save(ownerRoom);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("manager:ownerroom:update")
    public R update(@RequestBody OwnerRoomEntity ownerRoom){
		ownerRoomService.updateById(ownerRoom);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("manager:ownerroom:delete")
    public R delete(@RequestBody String[] orIds){
		ownerRoomService.removeByIds(Arrays.asList(orIds));

        return R.ok();
    }

}
